package cn.liontalk.ProxyPattern.pattern1;

import java.lang.reflect.Proxy;

public class ProxyMain {

    public static void main(String[] args) {
        //生成目标对象
        AppService target = new AppServiceImpl();
        //接下来创建代理对象
        AppService proxyInstance = (AppService) Proxy.newProxyInstance(target.getClass().getClassLoader(), target.getClass().getInterfaces(),
                new LoggerInterceptor(target));
        proxyInstance.createApp("Kevin Test");
    }
}
